import React from 'react';
import {Link} from 'react-router';
import { Tabs } from 'antd';
import DBTable from './LoanDbTable';
const TabPane = Tabs.TabPane;

/**
 * 定义sidebar组件
 */
class Sidebar extends React.Component {
  constructor(props) {
    super(props);
    this.state = { refreshTime: new Date(), tableType: 1 };
  }

  handleChange = (activeKey) => {
    activeKey = parseInt(activeKey, 10);
    // console.log(activeKey)
    this.setState({ tableType: activeKey});//tabs切换重新刷新
}

  render() {  
    // 这些样式其实是在App/index.less中定义的
    return (
      <div> 
        <Tabs tabPosition='left' onChange={this.handleChange}>
          <TabPane tab="借款列表" key="1">
          </TabPane>
          <TabPane tab="未分配列表" key="2">
            {/*<DBTable rowKey='2' tableName='creditaudit' tableType={2} ></DBTable>*/}
          </TabPane>
          <TabPane tab="初审列表" key="3">
            {/*<DBTable rowKey='3' tableName='creditaudit' tableType={3} ></DBTable>*/}
          </TabPane>
          <TabPane tab="终审列表" key="4">
            {/*<DBTable rowKey='4' tableName='creditaudit' tableType={4} ></DBTable>*/}
          </TabPane>
          <DBTable key="5" tableName='creditaudit' tableType={this.state.tableType}></DBTable>
        </Tabs>
      </div>
    );
  }

}

export default Sidebar;
